


// export function Main(Npc: TNormNpc, Player: TPlayObject, Args: TArgs) {

// }

export const dummyLoginCache:any []=[];


export function AddDummy(Player: TPlayObject):void
{
    let obj={
        account:Player.GetAccount(),
        name:Player.GetName(),
        x:Player.GetMapX(),
        y:Player.GetMapY(),
        map:Player.GetMap(),
    }
    dummyLoginCache.push(obj);
}

export function DummyLogin():void{

    console.debug("假人开始登录")
    let len=Math.min(dummyLoginCache.length,3);
    let array=dummyLoginCache.splice(0, len);
    console.debug(JSON.stringify(array))
    for(let i=0;i<len;i++)
    {
        let obj:any=array[i];
        const {account,name,x,y,map}=obj;
        let Obj: TPlayObject = GameLib.FindPlayer('张三');
        if (Obj) {
            console.debug("人物在线:"+name)
            continue;
        }
        let player:TPlayObject=GameLib.FindPlayerEx(account,name);
        if(player)
        {
            console.debug("找到人物:"+name)
            player.SetPVar(0,1);
            player.VarString('lastMap').AsString=map
            player.VarString('lastMapx').AsString=x
            player.VarString('lastMapy').AsString=y
        }
        
    }
}